package com.aloha.springframework.aop.framework;

import com.aloha.springframework.aop.AdvisedSupport;

public class ProxyFactory extends AdvisedSupport {

    public Object getProxy() {
        return createAopProxy().getProxy();
    }

    private AopProxy createAopProxy() {
        if (super.isProxyTargetClass() || super.getTargetSource().getTargetClass().length == 0) {
            return new CglibAopProxy(this);
        }
        return new JdkDynamicAopProxy(this);
    }
}
